home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 March / macformat-022.iso / Shareware City / Developers / src / inc-dec-nshell.hqx / inc-dec / How To (inc) < prev    next >
Encoding:
Text File  |  1994-10-20  |  792 b   |  48 lines

  1. How To
  2. ======
  3.  
  4. To use this command, drop the "inc" file into your nShell "bin" directory.
  5.  
  6. Description
  7. ===========
  8.  
  9. NAME
  10.  
  11. inc - Increment a variable
  12.  
  13. SYNOPSIS
  14.  
  15. inc variable [offset]
  16.  
  17. DESCRIPTION
  18.  
  19. This command will add an offset to a numeric variable:
  20.  
  21. variable = variable + offset
  22.  
  23. RETURN CODES
  24.  
  25. <0    Error
  26. 0    Success
  27.  
  28. Note
  29. ====
  30.  
  31. In normal usage, the variable name should not have a leading '$'.  Remember that "$name" forces an immediate interpretation, so that given:
  32.  
  33. set foo 5
  34. set bar foo
  35.  
  36. The command "inc foo" would increment the value of "foo" to 6.  The command "inc $bar" would accomplish the same thing, by first interpreting "$bar" to mean "foo" and then incrementing the contents of "foo".
  37.  
  38. Example
  39. =======
  40.  
  41. set foo 0
  42.  
  43. while .lt. $foo 10 do
  44.  echo "waiting..."
  45.  delay 1
  46.  inc foo
  47. done
  48.